package com.ruoyi.system.wnjk.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.wnjk.domain.po.ShopCart;
import com.ruoyi.system.wnjk.mapper.ShopCartMapper;
import com.ruoyi.system.wnjk.service.IShopCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 订单详情Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-11
 */
@Service
public class ShopCartServiceImpl implements IShopCartService
{
    @Autowired
    private ShopCartMapper shopCartMapper;

    /**
     * 查询订单详情
     *
     * @param id 订单详情主键
     * @return 订单详情
     */
    @Override
    public ShopCart selectShopCartById(Long id)
    {
        return shopCartMapper.selectShopCartById(id);
    }

    /**
     * 查询订单详情列表
     *
     * @return 订单详情
     */
    @Override
    public List<ShopCart> selectShopCartList(Long userId)
    {
        return shopCartMapper.selectShopCartList(userId);
    }

    /**
     * 新增订单详情
     *
     * @param shopCart 订单详情
     * @return 结果
     */
    @Override
    public int insertShopCart(ShopCart shopCart)
    {
        shopCart.setCreateTime(DateUtils.getNowDate());
        return shopCartMapper.insertShopCart(shopCart);
    }

    /**
     * 修改订单详情
     *
     * @param shopCart 订单详情
     * @return 结果
     */
    @Override
    public int updateShopCart(ShopCart shopCart)
    {
        shopCart.setUpdateTime(DateUtils.getNowDate());
        return shopCartMapper.updateShopCart(shopCart);
    }

    /**
     * 批量删除订单详情
     *
     * @param ids 需要删除的订单详情主键
     * @return 结果
     */
    @Override
    public int deleteShopCartByIds(Long[] ids)
    {
        return shopCartMapper.deleteShopCartByIds(ids);
    }

    /**
     * 删除订单详情信息
     *
     * @param id 订单详情主键
     * @return 结果
     */
    @Override
    public int deleteShopCartById(Long id)
    {
        return shopCartMapper.deleteShopCartById(id);
    }
}
